<?php
namespace api\modules\v1\controllers;

use api\modules\v1\models\transfer\Transfer;
use yii\filters\auth\HttpHeaderAuth;
use yii\helpers\ArrayHelper;

class TransferController extends DefaultController
{
    public $modelClass = '';

    public function behaviors()
    {
        return ArrayHelper::merge(parent::behaviors(), [
            'authenticator' => [
                'class' => HttpHeaderAuth::className(),    //head头部验证
                'header' => 'access-token',
                'optional' => [                     //需要过滤掉不用token参数的方法
                ]
            ]
        ]);
    }

    /**
     * 转账
     */
    public function actionTransfer($id = 0) {
        if (\Yii::$app->request->isPost) {
            return (new Transfer())->send();
        }

        if (\Yii::$app->request->isGet) {
            return (new Transfer())->getInfo($id);
        }
    }


}
